<template>
  <view>
    <view class="flex-between mt30 mb30 w">
      <view class="flex-align">
        <navigator url="/pages/tabbar/class" open-type="switchTab" hover-class="none"
          ><text class="mr10">筛选</text></navigator
        >
        <image src="@/static/images/sx.png" mode="scaleToFill" style="width: 26rpx; height: 26rpx" />
      </view>
      <view class="color-info">已显示全部{{ list.length }}件商品</view>
    </view>
    <!-- 商品列表 -->
    <goodsList :list="list" />
  </view>
</template>

<script setup lang="ts">
import homeApi from '@/api/homeApi'
import { onLoad } from '@dcloudio/uni-app'
import goodsList from '@/components/goodsList.vue'
import { ref } from 'vue'

const categoryOne = ref('')
const categoryTwo = ref('')
const categoryTre = ref('')
const clothName = ref('')

onLoad((e: any) => {
  categoryOne.value = e.categoryOne
  categoryTwo.value = e.categoryTwo
  categoryTre.value = e.categoryTre
  clothName.value = e.clothName
  uni.setNavigationBarTitle({ title: categoryTwo.value })

  getCategoryGoods()
})
const list: any = ref([])
const getCategoryGoods = () => {
  homeApi
    .getCategoryGoods({
      categoryOne: categoryOne.value,
      categoryTwo: categoryTwo.value,
      categoryTre: categoryTre.value,
      clothName: clothName.value,
    })
    .then((res: any) => {
      list.value = res
    })
}
</script>

<style lang="scss" scoped></style>
